package com.nengchuan.kbms.dfs.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nengchuan.config.exception.NcException;
import com.nengchuan.kbms.common.AutoWrapper;
import com.nengchuan.kbms.common.PageServiceImpl;
import com.nengchuan.kbms.dfs.dao.DataFileTagAttrMapper;
import com.nengchuan.kbms.dfs.dao.DataTagAttrMapper;
import com.nengchuan.kbms.dfs.entity.dto.*;
import com.nengchuan.kbms.dfs.entity.po.DataFileTagAttr;
import com.nengchuan.kbms.dfs.entity.po.DataTagAttr;
import com.nengchuan.kbms.dfs.entity.po.DataTagAttrOption;
import com.nengchuan.kbms.dfs.entity.vo.DataTagAttrVO;
import com.nengchuan.util.MapperUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * <p>
 * 文件标签属性关联 服务实现类
 * </p>
 *
 * @author zengshuai
 * @since 2020-06-08
 */
@Service
public class DataFileTagAttrServiceImpl extends PageServiceImpl<DataFileTagAttrMapper, DataFileTagAttr> implements DataFileTagAttrService {

    @Autowired
    private DataFileTagAttrMapper dataFileTagAttrMapper;

    /**
     * 保存文件的标签属性
     * @param dataTypeDTO
     */
    @Override
    public void saveFileTagAttr(DataFileTagAttrDTO dataTypeDTO) {
        DataFileTagAttr dataFileTagAttr = MapperUtils.mapping(dataTypeDTO, DataFileTagAttr.class);
        dataFileTagAttr.setCreateTime(new Date().getTime());
        dataFileTagAttrMapper.insert(dataFileTagAttr);
    }
}
